<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>会员列表</title>
    <meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0.maximum-scale=1.0,user-scalable=no" name="viewport">
	<script src="js/flexible.js"></script>
	<link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="css/homePage.css">
	<link rel="stylesheet" href="css/flexible.css">
	<link rel="stylesheet" href="css/vant.css">
    <script src="js/jquery-3.3.1.min.js"></script>
	<script src="js/vue/vue.js"></script>
	<script src="js/vue/axios.js"></script>
	<script src="js/vue/MD5.js"></script>
	<script src="js/vue/vant.js"></script>
</head>
<body>
<div id="app">
	<template>
		<div class="container_box" style="padding-bottom: .8rem">
				<header>
					<div class="search bar3" style="width: 100%">
						<form @submit.prevent action="#">
							<input style="width: 100%;" @keyup.enter.native="search" v-model="key" type="search" placeholder="搜索会员姓名/手机号码">
							<button @click="search" type="text"><img src="images/search.png"></button>
						</form>
					</div>
				</header>
				<div class="group_details group_details_state clearfix" v-for="item in list" @click="details(item.Uid)">
					<div class="fl head_card">
						<img :src="item.Picurl" onerror="this.src='images/moren.png'" alt="" class="spinning_img">
					</div>
					<div class="spinning_txt fl content_right">
						<p class="margin_bottom">
							<span class="fontsize12">{{item.Username}}</span>
							<span class="spinning_txx">
								<img v-if="item.Sex=='1'" src="images/man.png">
								<img v-else src="images/woman.png">
							</span>
						</p>
						<p style="margin-bottom: 0.1rem;">
							<span class="spinning_name">
								<a :href="'tel:' + item.Phone">{{item.Phone}}</a>
							</span>
						</p>
					</div>
				</div>
				<van-list
				v-model="loading"
				:finished="finished"
				finished-text="没有更多了"
				@load="onLoad"
				>
				<van-cell
					v-for="item in lists"
					:key="item"
					:title="item"
				/>
			</van-list>
		</div>	
	</template>
	<div class="footer_bar">
		<ul class="clearfix">
			<li>
				<a href="index.html" class="first_a">
					<p style="color: #333346;">首页</p>
				</a>
			</li>
			<li>
				<a href="league.html" class="second_a ">
					<p>代约团课</p>
				</a>
			</li>
			<li>
				<a href="privateLessons.html" class="thrid_a foot_active">
					<p>代约私教</p>
				</a>
			</li>
			<li>
				<a href="myMember.html" class="four_a">
					<p>我的会员</p>
				</a>
			</li>
		</ul>
	</div>
</div>
</body>
<script>
new Vue({
    el: '#app',
    data: {
        lists:[],
        loading: false,
		finished: false,
		isLoading: false,
		showSet:false,
        list:[],
        page:'1',
        moren:'images/moren.png',
        page:'',
        totalnum:'',
        totalpage:'',
		listd:[],
		key:''
    },
    created(){
        //this.onLoad()
    },
    methods:{
		 //设置参数
		 setCanS(){
            let Request = new Object()
            Request = GetRequest()
            // this.from.type = Request['type']
            // this.from.state = parseInt(Request['state'])
        },
        onLoad() {
            setTimeout(() => {
				//console.log('1')
                 // 异步更新数据
                const params={
					page:this.page,
					phone:this.key
                }
                getVs()
                axios.get('mobileapi/coach/curr.php?act=user_list',{params:params}).then(data =>{
                    console.log(data.data)
                    let { msg, code,user} = data.data
                        if (code !== 200) {
							window.vant.Toast.fail(msg)
                        } else {
                            data=data.data
                            this.listd=data.data.list
                            this.totalnum=data.data.totalnum
							this.page=parseInt(data.data.page)+1
                            for(let i in this.listd){
                                if(this.listd[i].Picurl==""||this.listd[i].Picurl==null){
                                    this.listd[i].Picurl='images/moren.png'
                                }
                            }
                            for (let i = 0; i < this.listd.length; i++) {
                                this.list.push(this.listd[i])
                            }
                            // 加载状态结束
                            this.loading = false
                            // 数据全部加载完成
                            if (this.list.length >= this.totalnum) {
                                this.finished = true
                            }
                        }
                    }).catch(function (error) {
                        console.log(error); 
                })
            }, 500);
        },
        //详情
        details(Uid){
            window.location.href='curriculum_p.html?uid='+Uid+''
        },
        search(){
			this.page='1'
			console.log(this.key)
			this.lists=[]
			this.list=[]
            this.onLoad()
		},
		showSets(){
			this.showSet=!this.showSet
		}
    }
})
</script>
</html>